﻿using DDE_Server.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DDE_Server.Object

{
    
    public class DataEntry
    {
        // Show data
        public string Status 
        { 
            //set
            //{

            //}
            get
            {
                return GetStatusText();
            }
        }

        public string Time {
            get {
                return GetTimerText();
            }
        }

        public string BidOffer 
        { 
            //set;
            get 
            {
                return Global.Text(bidOffer);
            }
        }

        public string Price
        {
            //set;
            get 
            {
                return string.Format("{0:00.00}", price);
            }
        }

        public string StripName { set; get; }

        public string BeginDate {
            get 
            {
                return GetDateText(beginDate);
            }
        }

        public string EndDate
        {
            get
            {
                return GetDateText(endDate);
            }
        }

        public string Strategy 
        { 
            //set;
            get 
            {
                return GetStrategyText();
            }
        }

        // This data not show

        public Result status { set; get; }

        public double price { set; get; }

        public BidOffer bidOffer { set; get; }

        public DateTime beginDate { set; get; }

        public DateTime endDate { set; get; }

        public Distpatch distpatch { set; get; }

        public Compare condition { set; get; }

        public double priceConditional { set; get; }

        public TimeSpan timer { set; get; }

        public TimeSpan timerCount { set; get; } 


        public DataEntry() {
            status = Result.NONE;
        }

        //public DataGridViewRow Row {

        //    get {
        //        DataGridViewRow row = new DataGridViewRow();


        //    }
        //}

        public string GetStrategyText() {

            return Global.Text(distpatch) + " " + Global.Text(condition) + " " + string.Format("{0:00.00}", priceConditional);
        }

        public string GetDateText(DateTime date)
        {

            return date.ToString("dd MMM yy");
        }

        public string GetTimerText() {
            return timer.ToString(@"mm\:ss");
        }
        public string GetStatusText()
        {
            return Global.Text(status);
        }


    }
}
